package com.ant.androidBuddy;

import android.app.*;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class AndroidBuddyActivity extends Activity  {

	//when it is created
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.android_buddy);
    }
    
    //when the new button is pressed
    public void new_animation(View view) {
    	//go to the animation activity
    	Intent intent = new Intent(AndroidBuddyActivity.this, AnimationActivity.class);
    	intent.putExtra("new", "start_new");
    	startActivity(intent);
    }
    
    //when the open button is pressed
    public void open_list(View view){
    	//go to the open activity
    	Intent intent = new Intent(AndroidBuddyActivity.this, OpenFileActivity.class); 
    	startActivity(intent);
    }
    
    //when the tutorial button is pressed
    public void open_tutorial(View view){
    	//open the animation activity in tutorial mode
    	Intent intent=new Intent(AndroidBuddyActivity.this,AnimationActivity.class);
    	intent.putExtra("tutorial", "start_tut");
    	startActivity(intent);
    }
    
    //when the about button is pressed
    public void show_alert(View view){
		//the dialog builder
		final AlertDialog.Builder alertBuilder=new AlertDialog.Builder(this);
		//set the message
		alertBuilder.setMessage(getString(R.string.about_us))
		//add a button that dismisses the message
		.setPositiveButton(R.string.OK_button, new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
				dialog.dismiss();
			}
		});
		//create the alert
		AlertDialog alert=alertBuilder.create();
		//show the alert
		alert.show();
    }
}
